package com.hwtx.form.util;

import org.apache.commons.io.monitor.FileAlterationMonitor;
import org.apache.commons.io.monitor.FileAlterationObserver;

import java.util.concurrent.TimeUnit;

public class FileMonitor {
    public void start(long duration, FileAlterationObserver observer) throws Exception {
        long interval = TimeUnit.SECONDS.toMillis(duration);
        FileAlterationMonitor monitor = new FileAlterationMonitor(interval, observer);
        monitor.start();
    }
}
